﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KmSql
{
    public static class KmSqlServiceExtensions
    {
        public static void AddKmSql(this IServiceCollection services, IConfiguration configuration)
        {
            var option = configuration.GetSection(KmSqlOptions.Name).Get<KmSqlOptions>();
            services.AddScoped<IKmSql>(x =>
            new KmSqlBuilder().UseDbConnection(option.DbType, option.ConnectionString).Build());
        }
    }
}
